<!-- 重置密码 -->
<template>
	<view class="restting-pass">
		<h2 style="text-align: center;padding: 30rpx 0;">重置密码</h2>
		<van-form @submit="onSubmit">
		  <van-field
		    v-model="password"
			 type="password"
		    name="password"
		    label="密码"
		    placeholder="密码"
		    :rules="[{ required: true, message: '请填写密码' }]"
		  />
		  <van-field
		    v-model="password1"
		    type="password"
		    name="password1"
		    label="确认密码"
		    placeholder="密码"
		    :rules="[{ required: true, message: '请填写密码' }]"
		  />
		  <div style="margin: 16px;">
			<van-button round block type="primary" 
			native-type="submit">提交</van-button>
		  </div>
		</van-form>
	</view>
</template>

<script setup>
import { ref } from 'vue';
import {useStore} from 'vuex'
import api from '../../lib/request';
const store  =useStore()
const password = ref('');
const password1 = ref('');
const id = ref(store.state.uid)
console.log(id.value);
const onSubmit = (values) => {
	let {password,password1} =values
	console.log(values);
	if(password==password1){
		api.update('/user/updateUser',{id:id.value,values}).then(res=>{
			if(res.code){
				uni.showToast({
					title: '修改' + (!code ? '失败' : '成功'),
					icon: 'none',
				})
			}
		})
		}
	}
	


</script>

<style>

</style>
